
let width = 980
let oMetaEl = window.document.querySelector('meta[name="viewport"]');
changeDpr(window.screen.availWidth)
window.addEventListener('resize', function(e) {
  changeDpr(e.target.screen.availWidth)
})


function changeDpr (availWidth) {
  console.log(availWidth)
  if(availWidth > width) {
    oMetaEl.setAttribute('content', 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=yes')
  } else {
    let dpr = ((((availWidth - 320) / width).toFixed(2) * 100 + 35) / 100).toFixed(2)
    oMetaEl.setAttribute('content', `width=device-width, initial-scale=1, minimum-scale=${dpr}, maximum-scale=${dpr}, user-scalable=yes`)

  }
}